All Questions
Tagged with c++performance
71 questions
2votes
2answers
413views
Game Systems Interaction Design
Intro I'm writing an FPS game in c++. There is a timed game mode, players run around a map shoot from a variety of weapons which are either hitscan or projectile based, when a shot connects, based on ...
15votes
6answers
6kviews
Why is it necessary to mark classes as not inherited from? Can't an optimizer automatically detect that virtual calls are unnecessary?
In C# and C++, an apparent trend is in place to reduce / avoid inheritance: C#: "Sealing types can improve performance." https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/...
2votes
1answer
1kviews
Saving and reading files in user specific application data in C or C++
Most useful or reasonably complex applications need to save data such as user settings or saved games or browser history. I have been working on applications and games in C or C++ but I am not sure ...
2votes
0answers
215views
Speed up implementation of "log transform" on 2D image
I'm working on an implementation of the "log transform" operator on an image for C++, and we currently have it formulated as follows (python code). Note we use log10 instead of the natural ...
0votes
1answer
150views
Best software architecture approach for a single core system
Objective: Designing a data intensive application(myApp) C++ on Linux/RTOS which runs on a single core cpu, there are also 150 other applications share the same core with high priority than myApp. How ...
-1votes
2answers
254views
Performance hit after non-functional refactoring
I was asked to refactor some C++ code recently for the purposes of increasing unit testing coverage. The problem was that the code was tightly coupled on one compilation unit, so we had the equivalent ...
2votes
1answer
424views
Difference between `Class.X` and `Class.getX()`?
Might be a silly question or something I might have just messed up in my head but here we go... I saw a code example of someone using getPos() in their own class to retrieve the current position of an ...
3votes
1answer
893views
C++: Broadcast/observer pattern with polymorphic events
I'm currently trying to implement an event-system following a broadcast/observer scheme. I have events/notifications that contain information about what is happening: class Event { public: Event(...
4votes
1answer
4kviews
In C++, If a member function can be made static with no change to functionality, are there any performance or memory benefits from doing so?
A very straightforward question. When I think about many of the member functions I create for my classes, many of them can be made static without affecting any functionality whatsoever. If I do so; ...
0votes
2answers
1kviews
Is it good practice to throw exceptions in parsing functions
I basically read across the entire internet that exceptions are bad, slow and should be avoided whenever possible. This confuses me because I thought I have a "valid" case to use exceptions. Consider ...
0votes
0answers
282views
How can you multithread an html parser [ in C++ and similar languages ]?
Ive done two HTML parsers. Done with Regular Expressions [that accounted for nesting]. It was quick, but error prone. Done by evaluating Character by Character through switches. Here was the basic ...
1vote
2answers
6kviews
Will compiled python code be as fast as compiled C++ code?
I know that Python is an interpreted language and that c++ is a compiled one, or at least I like to think that I've understood some of their differences. Although C++ is apparently faster than ...
1vote
2answers
797views
How to declare and share a lot of variables to provide best performance
My question is not about dilemma between clean code vs performance, but I want to understand exact issue with declaring variables and sharing them between functions. I read in many threads, that from ...
2votes
1answer
145views
Optimal design for improved performance of a simulation code
I'm writing a code for the Discrete Element Method where I have balls (spheres) and walls (planes) interacting with each other. Those simulations are run for billions of time steps, so performance ...
8votes
1answer
665views
How can I optimize a program's performance when no profiling tools are available?
I am currently working on an OpenGl program whose performance I would like to improve. The performance is okay but not ideal on powerful dedicated GPUs, but is abysmal on integrated graphics (< 10 ...